﻿// dlib2call.cpp : Defines the entry point for the console application.
//

#include <Windows.h>
#include <tchar.h>
#include <stdio.h>

typedef int(* lpfun)(int, int);
int main(int argc, char* argv[])
{

	HINSTANCE hDll;
	lpfun addFun;
	hDll = LoadLibrary(_T("..\\Debug\\dlib2.dll"));
	if (hDll != NULL)
	{
		
		//addFun = (lpfun)GetProcAddress(hDll, "add");
		addFun = (lpfun)GetProcAddress(hDll, MAKEINTRESOURCEA(1));
		//MAKEINTRESOURCE直接使用导出文件中的序号
		if (addFun != NULL)
		{
			int result = addFun(2, 3);
			printf("\ncall add in dll:%d", result);
		}
		FreeLibrary(hDll);
	}
	getchar();
	return 0;
}

